import { IParam, EntityBase } from "@/core";
import { IMicroComponent } from './interface/i-micro-component';
import MicroComponentKeys from './micro-component-keys';

/**
 * 微组件基类
 * 基于template/src/api/{{appEntities}}/{{appEntities}}-base.ts.hbs生成  
 *
 * @export
 * @abstract
 * @class MicroComponentBase
 * @extends { EntityBase }
 * @implements { IMicroComponent }
 */
export abstract class MicroComponentBase extends EntityBase implements IMicroComponent {
	/**
	 * 实体名称
	 *
	 * @readonly
	 * @type {string}
	 * @memberof MicroComponentBase
	 */
	get srfdename(): string {
		return 'MICROCOMPONENT';
	}

	/**
     * 当前实体所有属性
     *
     * @protected
     * @type {string[]}
     * @memberof MicroComponentBase
     */
    protected get keys(): string[] {
        return MicroComponentKeys;
    }

	/**
	 * Creates an instance of ConstactOppoBase.
	 * @param {*} [data]
	 * @memberof MicroComponentBase
	 */
	constructor(data?: any) {
		super();
		this.setData(data);
	}

	/**
	 * 建立时间
	 **/
	createdate?: any;
	
	/**
	 * 建立人
	 **/
	createman?: any;
	
	get srfmajortext(): string {
		return this.microcomponentname;
	}

	set srfmajortext(val: string) {
		this.microcomponentname = val;
	}
	/**
	 * 微组件名称
	 **/
	microcomponentname?: any;
	
	get srfkey(): string {
		return this.microcomponentid;
	}

	set srfkey(val: string) {
		this.microcomponentid = val;
	}

	/**
	 * 微组件标识
	 **/
	microcomponentid?: any;
	
	/**
	 * 更新时间
	 **/
	updatedate?: any;
	
	/**
	 * 更新人
	 **/
	updateman?: any;
	
	/**
	 * 属性
	 **/
	field?: any;
	
	/**
	 * 属性2
	 **/
	field2?: any;
	
	/**
	 * 属性3
	 **/
	field3?: any;
	
	/**
	 * 属性4
	 **/
	field4?: any;
	
	/**
	 * 属性5
	 **/
	field5?: any;
	
	/**
	 * 属性6
	 **/
	field6?: any;
	
	/**
	 * 属性7
	 **/
	field7?: any;
	
	/**
	 * 属性8
	 **/
	field8?: any;
	
	/**
	 * 属性9
	 **/
	field9?: any;
	
	/**
	 * 属性10
	 **/
	field10?: any;
	
	/**
	 * 属性11
	 **/
	field11?: any;
	
	/**
	 * 属性12
	 **/
	field12?: any;
	
	/**
	 * 属性13
	 **/
	field13?: any;
	
	/**
	 * 属性14
	 **/
	field14?: any;
	
	/**
	 * 属性15
	 **/
	field15?: any;
	
	/**
	 * 属性16
	 **/
	field16?: any;
	
	/**
	 * 属性17
	 **/
	field17?: any;
	
	/**
	 * 属性18
	 **/
	field18?: any;
	
	/**
	 * 属性19
	 **/
	field19?: any;
	
	/**
	 * 属性20
	 **/
	field20?: any;
	
	/**
	 * 属性21
	 **/
	field21?: any;
	
	/**
	 * 属性22
	 **/
	field22?: any;
	
	/**
	 * 属性23
	 **/
	field23?: any;
	
	/**
	 * 属性24
	 **/
	field24?: any;
	
	/**
	 * 属性25
	 **/
	field25?: any;
	
	/**
	 * 属性26
	 **/
	field26?: any;
	
	/**
	 * 属性27
	 **/
	field27?: any;
	
	/**
	 * 属性28
	 **/
	field28?: any;
	
	/**
	 * 属性29
	 **/
	field29?: any;
	
	/**
	 * 属性30
	 **/
	field30?: any;
	
	/**
	 * 属性31
	 **/
	field31?: any;
	
	/**
	 * 属性32
	 **/
	field32?: any;
	
	/**
	 * 属性33
	 **/
	field33?: any;
	
	/**
	 * 属性34
	 **/
	field34?: any;
	
	/**
	 * 属性35
	 **/
	field35?: any;
	
	/**
	 * 属性36
	 **/
	field36?: any;
	
	/**
	 * 属性37
	 **/
	field37?: any;
	
	/**
	 * 属性38
	 **/
	field38?: any;
	
	/**
	 * 属性39
	 **/
	field39?: any;
	
	/**
	 * 属性40
	 **/
	field40?: any;
	

	/**
	 * 重置实体数据
	 *
	 * @param {IParam} [data={}]
	 * @memberof MicroComponentBase
	 */
	reset(data: IParam = {}): void {
		super.reset(data);
		this.microcomponentname = data.microcomponentname || data.srfmajortext;
		this.microcomponentid = data.microcomponentid || data.srfkey;
	}
}